package com.example.teachingevaluationsystem.service.impl;

import com.example.teachingevaluationsystem.entity.Evaluate;
import com.example.teachingevaluationsystem.mapper.EvaluateMapper;
import com.example.teachingevaluationsystem.service.EvaluateService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.teachingevaluationsystem.vo.ScoreVo;
import com.example.teachingevaluationsystem.vo.ScoringData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 评价 服务实现类
 *
 * @author lp
 * @since 2022-03-28
 */
@Service
public class EvaluateServiceImpl extends ServiceImpl<EvaluateMapper, Evaluate>
    implements EvaluateService {

  @Autowired public EvaluateMapper evaluateMapper;

  @Override
  public List<ScoreVo> getScoreVo(Long id, Long planId, Long courseId, Boolean isTeacher) {
    if (isTeacher) {
      return evaluateMapper.selectScoreVoByTeacher(id, planId, courseId);
    }
    return evaluateMapper.selectScoreVo(id, planId, courseId);
  }

  public List<ScoringData> export(Long id, Long planId, Long courseId) {
    return  evaluateMapper.selectScoringData(id,planId,courseId);
  }
}
